package com.msb.mall.order.utils;

import com.msb.common.constant.OrderConstant;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

@Component
public class OrderMsgProduct {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    public void sendMsg(String orderSN){
        System.out.println("订单创建成功发送消息"+orderSN);
        rocketMQTemplate.syncSend(OrderConstant.ROCKETMQ_ORDER_TOPIC, MessageBuilder.withPayload(orderSN).build(),5000,4);
    }

}
